package com.example.mypotiota_si.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.mypotiota_si.Adapter.ListViewAdapter_school;
import com.example.mypotiota_si.Datas.Xiaoxi_nr;
import com.example.mypotiota_si.Datas.XueXiao;
import com.example.mypotiota_si.Datas.XueXiao_nr;
import com.example.mypotiota_si.R;

import java.util.ArrayList;

public class ShouYe_SchoolActivity extends AppCompatActivity {
    ImageView fh;
    ArrayList<XueXiao> school_name=new ArrayList<>();
    ListViewAdapter_school school_adapter;
    RecyclerView school_recycler;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sy_school);
        //隐藏标题栏
        ActionBar actionBar=getSupportActionBar();
        if (actionBar!=null){
            actionBar.hide();
        }
        //添加数据
        init_data();
        //找到控件
        fh=findViewById(R.id.school_fh);
        school_recycler=findViewById(R.id.recycle_school_view);

        //页面布局
        LinearLayoutManager layoutManager=new LinearLayoutManager(this);
        layoutManager.setOrientation(RecyclerView.VERTICAL);
        school_recycler.setLayoutManager(layoutManager);
        school_adapter=new ListViewAdapter_school(school_name);
        school_recycler.setAdapter(school_adapter);
        //点击监听
        init_dj();
    }
//添加数据
    private void init_data() {
        school_name=new ArrayList<>();
        for (int i = 0; i < XueXiao_nr.school_name.length; i++) {
            XueXiao xx=new XueXiao();
            xx.school_name=XueXiao_nr.school_name[i];
            school_name.add(xx);
        }
    }

    //点击监听
    private void init_dj() {
        //点击返回
        fh.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
